#!/bin/sh

PROJ=$(cd `dirname $0`; pwd)
SRC=$PROJ/src
if [ "$1" = "debug" ]; then
	BUILD=$PROJ/debug
else
	BUILD=$PROJ/build
fi

rm -rf $BUILD

if [ ! -d $BUILD ]; then
	mkdir $BUILD;
fi

pushd $BUILD
if [ "$1" = "debug" ]; then
	echo " ----> Generate DEBUG Makefiles ..."
	cmake -DCMAKE_BUILD_TYPE="debug" -G "MSYS Makefiles" ..
    make VERBOSE=1
else
	echo " ----> Generate RELEASE Makefiles ..."
	cmake -DCMAKE_BUILD_TYPE="release" -G "MSYS Makefiles" ..
    make
fi

popd